local yijue = fk.CreateSkill{
  name = "mod__yijue",
}
local yijue_ = {
  name = "mod__yijue",
  anim_type = "offensive",
  card_num = 1,
  card_filter = function(self, player, to_select, selected)
    return #selected == 0 and not player:prohibitDiscard(Fk:getCardById(to_select))
  end,
  target_num = 1,
  target_filter = function(self, player, to_select)
    return to_select ~= player and not to_select:isKongcheng()
  end,
  can_use = function(self, player)
    return player:usedSkillTimes(self.name, Player.HistoryPhase) == 0
  end,
  on_use = function(self, room, effect)
    local from = effect.from
    room:throwCard(effect.cards, self.name, from, from)
    local to = effect.tos[1]

    if to:isKongcheng() then return end

    local showCard = room:askForCard(to, 1, 1, false, self.name, false, nil, "#yijue-show::"..from.id)[1]
    to:showCards(showCard)

    showCard = Fk:getCardById(showCard)
    if showCard.color == Card.Black then
      local mark = to:getTableMark("@@yijue-turn")
      table.insert(mark, from.id)
      room:setPlayerMark(to, "@@yijue-turn", mark)
      room:addPlayerMark(to, MarkEnum.UncompulsoryInvalidity .. "-turn")
    else
      room:obtainCard(from, showCard, true, fk.ReasonPrey)
      if not to.dead and to:isWounded() then
        if room:askForSkillInvoke(from, self.name, nil, "#yijue-recover::"..to.id) then
          room:recover({
            who = to,
            num = 1,
            recoverBy = from,
            skillName = self.name,
          })
        end
      end
    end
  end
}
local yijue_prohibit = {
  prohibit_use = function(self, player, card)
    return player:getMark("@@yijue-turn") ~= 0
  end,
  prohibit_response = function(self, player, card)
    return player:getMark("@@yijue-turn") ~= 0
  end,
}
yijue:addEffect("active", yijue_)
yijue:addEffect("prohibit", yijue_prohibit)
return yijue